package com.cty.ioc_04;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class JavaBean {
    //怎么用注解引入全局属性
    //1.直接赋值
    private String name = "cty";


    //2.用@Value标记
    @Value("18")
    private int age;

    //感觉比较麻烦@Value主要用来引入外部配置
    @Value("${username}")//引入外部的配置文件属性
    private String username;

    @Value("${password}")
    private String password;
}
